<?php
		$iID=$_POST['iID'];
		$imobilephone=$_POST['imobilephone'];
		$ipassword=$_POST['ipassword'];
		$servername = "127.0.0.1";
		$username = "root";
		$password = "";
		$dbname = "OnlineDeliverOrderSystem_schema";
		// 创建连接
		$conn = new mysqli($servername, $username, $password, $dbname);
		// 检测连接
		if ($conn->connect_error) {
		    die("连接失败: " . $conn->connect_error);
		}
		
		$sequrySql=sprintf("SELECT * FROM user WHERE ID='%s'",$iID);
		$result = mysqli_query($conn,$sequrySql);
		
		while($row = mysqli_fetch_array($result))
		{
		    if($row['ID']==$iID||$row['mobilephone']==$imobilephone){
		    	$conn->close();
		    	echo 2;//此账号或者手机号已经注册
		    }else{
		    	continue;
		    }
		}
		
		$insertSql = sprintf("INSERT INTO user (ID, mobilephone, password) VALUES ('%s', '%s', '%s')", $iID, $imobilephone, $ipassword);
			
		if ($conn->query($insertSql) === TRUE) {
			$conn->close();
		    echo 0;//注册成功
		} else {
			$conn->close();
		    echo 1;//注册失败
		}
?>